let arr = [1, 2, 3, 4, 5, 5, 4, 3, 2, 1];
let arr2 = [3, 2, 1, 6, 5, 4, 1, 2, 3, 5, 4, 9, 8, 7, 0];

//单数组去重
let set = new Set(arr);
let newArr = [...set];
console.log(newArr);

//多数组去重
let combinedSet = new Set([...arr, ...arr2]);
let combinedArr = [...combinedSet];
console.log(combinedArr)

//两个数组的交集
let set1 = new Set(arr);
let set2 = new Set(arr2);
// 获取交集
let intersection = set1.intersection(set2);
//交集转回数组
let intersectionArr = [...intersection];
console.log(intersectionArr);
//获取差集
let difference = set1.difference(set2);
//差集转回数组
console.log(difference);